/
PurgeLogBuffer.cs
41 lines (37 loc) · 1.54 KB
/
PurgeLogBuffer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Services.Log.EventLog
{
using System;
using DotNetNuke.Services.Scheduling;
public class PurgeLogBuffer : SchedulerClient
{
/// <summary>Initializes a new instance of the <see cref="PurgeLogBuffer"/> class.</summary>
/// <param name="objScheduleHistoryItem"></param>
public PurgeLogBuffer(ScheduleHistoryItem objScheduleHistoryItem)
{
this.ScheduleHistoryItem = objScheduleHistoryItem;
}
/// <inheritdoc/>
public override void DoWork()
{
try
{
// notification that the event is progressing
this.Progressing(); // OPTIONAL
LoggingProvider.Instance().PurgeLogBuffer();
this.ScheduleHistoryItem.Succeeded = true; // REQUIRED
this.ScheduleHistoryItem.AddLogNote("Purged log entries successfully"); // OPTIONAL
}
catch (Exception exc)
{
this.ScheduleHistoryItem.Succeeded = false; // REQUIRED
this.ScheduleHistoryItem.AddLogNote("EXCEPTION: " + exc); // OPTIONAL
this.Errored(ref exc); // REQUIRED
// log the exception
Exceptions.Exceptions.LogException(exc); // OPTIONAL
}
}
}
}